<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:p="http://primefaces.prime.com.tr/ui"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core">
    <h:head>
        <title>Facelet Title</title>
    </h:head>
    <h:body>
       <h:form id="userManage">
           <p:panel id="panel" header="New Person" style="margin-bottom:10px;">
                <p:messages id="messages"/>  
          <h:panelGrid columns="3">  
                     
               <h:outputLabel for="username" value="UserName"/>    
            <p:inputText id="username" value="#{userManagedBean.username}"/>
            
            <p:message for="username" />  
            
             <h:outputLabel for="country" value="Country"/>
            <p:inputText id="country" value="#{userManagedBean.country}"/>
            <p:message for="country"/>
            
            <h:outputLabel for="zipcode" value="ZipCode"/>        
            <p:inputText id="zipcode" value="#{userManagedBean.zipcode}"/>
            
            <p:message for="zipcode"/>
            
            <h:outputLabel for="email" value="Email"/>     
            <p:inputText id="email" value="#{userManagedBean.email}"/>
            <p:message for="email"/>
            
            <h:outputLabel for="password" value="Password"/>
            <p:inputText id="password" value="#{userManagedBean.password}"/>
            <p:message for="password"/>
            
            <h:outputLabel for="bankaccount" value="Bankaccount"/>       
            <p:inputText id="bankaccount" value="#{userManagedBean.bankaccount}"/>
            <p:message for="bankaccount"/>
            
            <p:commandButton value="submit UserInformation" actionListener="#{userManagedBean.submitUser(event)}" ajax="false" update="datatable"/>
         </h:panelGrid> 
       </p:panel>
    </h:form>
<h:form> 
    <h:dataTable id="datatable" value="#{userManagedBean.allUsers}" 
                     var="event"
                     summary="Table showing all events">
            <h:column>
                <f:facet name="header">
                    <h:outputText value="Customer Name" />
                </f:facet>
                <h:outputText value="#{event.name}" />
            </h:column>
            <h:column>
                <f:facet name="header">
                    <h:outputText value="Location country" />
                </f:facet>
                <h:outputText value="#{event.address.country}" />
            </h:column>
            <h:column>
                <f:facet name="header">
                    <h:outputText value="Location ZipCode" />
                </f:facet>
                <h:outputText value="#{event.address.zipcode}" />
            </h:column>
            <h:column>
                <f:facet name="header">
                    <h:outputText value="Email               " />
                </f:facet>
                <h:outputText value="#{event.customerId.email}" />
            </h:column>
            <h:column>
                <f:facet name="header">
                    <h:outputText value="Password              "/>
                </f:facet>
                <h:outputText value="#{event.customerId.password}" />
            </h:column>
            <h:column>
                <f:facet name="header">
                    <h:outputText value="Bank Account" />
                </f:facet>
                <h:outputText value="#{event.bankAccount}" />
            </h:column>
            <h:column>
                <f:facet name="header">
                    <h:outputText value="Id" />
                </f:facet>
                <h:outputText value="#{event.id}" />
            </h:column>
        <h:column>
                <f:facet name="header">
                    <h:outputText value="Status" />
                </f:facet>
            <p:commandButton value="Delete" actionListener="#{userManagedBean.deleteUser(event)}" ajax="false">
                    <f:attribute name="ID" value="#{event.id}" />
                </p:commandButton>
            </h:column>
        </h:dataTable>
 </h:form>
        <h:form>
            <p:commandButton value="Next >" action="editItem.xhtml" ajax="false" rendered="true"/>
        </h:form>
    </h:body>
</html>

